package ProducerConsumer;

public class Consumer extends Thread{
    private Warehouse warehouse;//放数据的仓库
    public Consumer(Warehouse warehouse){
        this.warehouse=warehouse;
    }
    public void run(){
        int value=0;
        for(int i=1;i<=10;i++){
            value=warehouse.get();//从仓库中取出数据，并放入value变量
            System.out.println("Consumer got:"+value);
        }
    }
}
